import axios from 'axios';
const http = axios.create({
  // baseURL: 'https://www.jianshu.com/asimov',
});

// 拦截后端返回信息进行处理
// http.interceptors.response.use(
//   (response) => {
//     return response.data;
//   },
//   (error) => {
//     const response = error.response;
//     if (response && response.status === 500) {
//       //  处理500错误
//     }
//     return Promise.reject(error.response.data);
//   }
// );

const Request = {
  get(url, params) {
    return http({
      url: url,
      params: params,
      method: 'GET',
      headers: {},
    });
  },
  post(url, data) {
    return http.post(url, data, { headers: {} });
  },
  delete(url) {
    return http.delete(url, { headers: {} });
  },
};
export default Request;
